<div id="main_content" class="updateSalaryInfo">
    <h3><?php echo $title; ?></h3>
    <a href="<?php echo base_url('/employee/salary-info'); ?>" class="btn addEmoloyeeBack m10"><?php echo $back; ?></a>
    <div class="form_add">   
        <form action="" method="post">
            <table border="0" class="add_data">
                <tr>
                    <td align="right"><label><?php echo $lblEmployeeName; ?></label></td>
                    <td><label><a title="<?php echo dQuotes($employeeName); ?>" href="<?php echo base_url('/employee/update/'); ?>" class="useritem"><?php echo subString($employeeName); ?></a></label></td>
                    <td></td>
                </tr>
                <tr>
                    <td align="right"><label><?php echo $lblGrossSalary; ?> <font color="#FF0000">(*)</font></label></td>
                    <td><input type="text" name="txtGrossSalary" size="20" maxlength="5" class="txtGrossSalary" value="<?php echo $txtGrossSalary; ?>"> &nbsp;<label><?php echo $lblUSD; ?></label>
                    </td>
                    <td><div class="error"><?php echo form_error('txtGrossSalary'); ?></div></td>
                </tr>
                <tr>
                    <td align="right"><label><?php echo $lblApplyDate; ?> <font color="#FF0000">(*)</font></label></td>
                    <td><input type="text" name="txtApplyDate" size="20" class="datepicker txtApplyDate" maxlength="7" value="<?php echo $txtApplyDate; ?>"><i>(<?php echo $this->lang->line('formatMonth'); ?>)</i></td>
                    <td><div class="error"><?php echo form_error('txtApplyDate'); ?></div></td>
                </tr>
                <?php if ($salaryInfoId) { ?>
                    <tr>
                        <td align="right"><label><?php echo $lblDelete; ?> </label></td>
                        <td>
                            <input type="checkbox" name="txtDelete" class="txtDelete" value="1" <?php echo ($txtDelete) ? 'checked' : ''; ?>/>
                        </td>
                        <td>
                            <span class="error"><?php echo form_error('txtDelete'); ?>
                        </td>
                    </tr>
                <?php } ?>
                <tr>
                    <td align="left">
                        <input type="hidden" name="txtEmployeeId" value="<?php echo $employeeID; ?>">
                        <input type="hidden" name="txtSalaryInfoId" value="<?php echo $salaryInfoId; ?>">
                        <input type="submit" name="btnSubmit" value="<?php echo $submit; ?>">
                    </td>            
                    <td></td>
                    <td></td>
                </tr>                                                                                         
            </table> 
        </form>
    </div>
</div>
<div class="redirectTo">
    <form class="frmRedirectTo" class="frmRedirectTo" name="frmRedirectTo" action="" method="POST">
        <input type="hidden" name="txtEmployeeId" class="employeeID" value="<?php echo $employeeID; ?>">
    </form>
</div>
<!-- BEGIN dialog message -->
<div id="dialog" title="<?php echo $dialogTitle; ?>">
    <?php echo isset($message) ? $message : ''; ?>
</div>
<!-- END dialog message -->
<script type="text/javascript">
    $(document).ready(function() {
        $(function() {
            $(".datepicker").datepicker({
                dateFormat: 'yy/mm',
                showOn: "button",
                buttonImage: "<?php echo base_url(); ?>/public/sites/images/calendaricon.gif",
                buttonImageOnly: true,
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                closeText: '<?php echo $this->lang->line('MC018'); ?>',
                yearRange: '<?php echo $minYear . ':' . $maxYear; ?>',
                defaultDate: new Date(<?php echo $txtDateYear; ?>,<?php echo $txtDateMonth; ?>, 1),
                onClose: function(dateText, inst) {
                    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                    $(this).datepicker('setDate', new Date(year, month, 1));
                }
            });
        });
<?php if (isset($flag) && $flag == TRUE): ?>
            $(function() {
                $("#dialog").dialog({
                    modal: true,
                    close: function() {
                        $('.frmRedirectTo').attr('action', '<?php echo base_url('/employee/salary-info'); ?>');
                        $('.frmRedirectTo').submit();
                    },
                    buttons: [{
                            text: '<?php echo $this->lang->line('MC019'); ?>',
                            click: function() {
                                $('.frmRedirectTo').attr('action', '<?php echo base_url('/employee/salary-info'); ?>');
                                $('.frmRedirectTo').submit();
                            }
                        }],
                });
            });
<?php elseif (isset($flag) && $flag == FALSE): ?>
            $(function() {
                $("#dialog").dialog({
                    buttons: [{
                            text: '<?php echo $this->lang->line('MC019'); ?>',
                            click: function() {
                                $("#dialog").dialog('close');
                            }
                        }]
                });
            });
<?php endif; ?>
        /*change link action to post action*/
        $('a.addEmoloyeeBack, a.useritem').click(function(e) {
            e.preventDefault();
            var url = $(this).attr('href');
            $('.frmRedirectTo').attr('action', url);
            $('.frmRedirectTo').submit();
        });
    });
</script>
<style>
    .ui-datepicker-calendar{
        display: none;
    }
</style>